refactor(@angular/cli): transition update command to use PackageManager abstraction#33364
Open
clydin wants to merge 3 commits into
Open
refactor(@angular/cli): transition update command to use PackageManager abstraction#33364clydin wants to merge 3 commits into
clydin wants to merge 3 commits into
Conversation
6cdfcbc to
93c2ef7
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the update resolution mechanism in the Angular CLI to use a new RegistryClient class for caching package metadata and manifests, while also moving several dependencies (like pacote, ini, and @yarnpkg/lockfile) to the root package.json. The review feedback suggests improving the robustness of the RegistryClient cache by removing rejected promises to prevent cache poisoning, and optimizing performance by parallelizing sequential async operations using Promise.all when building package info and printing update usage messages.
a972cab to
dbc0c36
Compare
…er abstraction Transition the update command's version resolver to utilize the registry methods from the PackageManager abstraction instead of directly querying the registry via pacote. This introduces a cached RegistryClient wrapper that retrieves package metadata and manifests on-demand. Update resolution helper functions are updated to be asynchronous to support the lazy-loading of registry documents.
…y authentication Configure always-auth in the written .npmrc and .yarnrc test profiles within createNpmConfigForAuthentication. By default, Yarn Classic (v1) does not send the Authorization header on GET requests (such as retrieving manifest metadata via yarn info) unless always-auth is enabled. When ng update uses the PackageManager abstraction under Yarn Classic v1, this ensures the necessary authorization headers are sent to secure registry endpoints.
When running scripts via Yarn Classic (such as yarn ng update), Yarn automatically injects npm_config_registry=https://registry.yarnpkg.com into the child process environment. When the PackageManager abstraction spawns child CLI subprocesses (such as yarn info), those child processes inherit the injected registry environment variable. Because environment variables take highest precedence, this previously caused spawned subprocesses to ignore local .yarnrc files and query the public CDN mirror. Strip npm_config_registry and NPM_CONFIG_REGISTRY from the child process environment when running under Yarn so that spawned subprocesses correctly respect local repository registry settings.
dbc0c36 to
9e77dfc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Transition the update command's version resolver to utilize the registry methods from the PackageManager abstraction instead of directly querying the registry via pacote.
This introduces a cached RegistryClient wrapper that retrieves package metadata and manifests on-demand. Update resolution helper functions are updated to be asynchronous to support the lazy-loading of registry documents.
Fixes #33119 (Honors minimum-release-age and supply-chain policies)
Fixes #27163 (Enforces project-scoped .npmrc / .yarnrc registry settings)
Fixes #26505 (Yarn Plug'n'Play compatibility)
Fixes #28834 (Gracefully handles private/unpublished packages via local package info)